﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data;
using System.Data.SqlClient;
using System.Windows.Forms;

namespace WindowsFormsApplication1
{
    class autoNumber
    {
        private DataTable AutoNumberedTable(DataTable SourceTable)
        {

            DataTable ResultTable = new DataTable();

            DataColumn AutoNumberColumn = new DataColumn();

            AutoNumberColumn.ColumnName = "STT";

            AutoNumberColumn.DataType = typeof(int);

            AutoNumberColumn.AutoIncrement = true;

            AutoNumberColumn.AutoIncrementSeed = 1;

            AutoNumberColumn.AutoIncrementStep = 1;

            ResultTable.Columns.Add(AutoNumberColumn);

            ResultTable.Merge(SourceTable);

            return ResultTable;

        }
        private string ConnectionString
        {

            get
            {

                SqlConnectionStringBuilder ConnectionBuilder = new SqlConnectionStringBuilder();

                ConnectionBuilder.DataSource = "myDataSource";

                ConnectionBuilder.InitialCatalog = "myDatabase";

                ConnectionBuilder.UserID = "myUserID";

                ConnectionBuilder.Password = "myPassword";

                return ConnectionBuilder.ToString();

            }

        }
    }
}
